# coding=utf-8
from rest_framework.authentication import SessionAuthentication
from rest_framework.permissions import IsAdminUser
from rest_framework.response import Response
from rest_framework.views import APIView

from backstage.permission.utils import view_funcs


class AdminList(APIView):

    authentication_classes = (SessionAuthentication,)
    permission_classes = (IsAdminUser,)

    def get(self, request):
        """
        获取管理员列表
        """
        admins = view_funcs.get_admin_list()
        return Response({
            "status": 200,
            "msg": "success",
            "data": admins,
        })
